package com.sxz.sbs.module.client.presenter;

import com.sxz.sbs.app.App;
import com.sxz.sbs.entity.AuthorityEntity;
import com.sxz.sbs.module.client.view.ClientManagementView;
import com.sxz.sbs.module.home.bean.HomeBean;
import com.sxz.sbs.rx.RxPresenter;
import com.sxz.sbs.rx.RxSubscriber;
import com.sxz.sbs.rx.RxUtil;

import java.util.HashMap;
import java.util.List;

/**
 * 客户管理
 */
public class ClientManagementPresenter extends RxPresenter<ClientManagementView>{
    /**
     * 登录
     * @param map
     */
    public void getClientManagementList (final HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().getAuthority(map)
                .compose(RxUtil.<List<AuthorityEntity>>handleResult())
                .subscribeWith(new RxSubscriber<List<AuthorityEntity>>(mView){
                    @Override
                    public void onNext(List<AuthorityEntity> data) {
                       mView.onClientManagementSuccess(data);
                    }
                })
        );
    }
}
